<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <title></title>
        <#include "/inc/head.ftl"/>
    	<@head/> 
</head>
<body>
            <div class="panel panel-default">
                <div class="panel-body">
                    <div class="row">
						<div class="col-lg-12">
                            <form id="form" action = "${contextPath}/orderform/update" role="form" method="post">
                                <input  id="orderformId" name= "orderformId" type="hidden" value="${(orderform.orderformId)!}" class="form-control">
                                <div class="form-group">
                                    <label>订单编号</label>
                                    <input id="orderformNumber" name="orderformNumber" value="${(orderform.orderformNumber)!}" class="form-control" disabled="disabled" >
                                </div>
              
                                <div class="form-group">
                                    <label>客户</label>
                                    <select id="customerId"  name="orderform.customerId" class="form-control">
                                    </select>
                                </div>
                                
                                <div class="form-group">
                                    <label>项目</label>
                                    <select id="projectId"  name="orderform.projectId"  class="form-control">
                                    </select>
                                </div>
                                
                                <div class="form-group">
                                    <label>技师</label>
                                    <select id="userId"  name="orderform.userId"  class="form-control">
                                    </select>
                                </div>
                                
                                <div class="form-group">
                                    <label>房间</label>
                                    <select id="roomId"  name="orderform.roomId"  class="form-control">
                                    </select>
                                </div>
                                
                                <div align="right">
                                <button id="btn-submit"  type="submit"  class="btn btn-default">提交</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
                <!-- /.panel-body -->
       </div>
       <!-- /.panel -->
       <script>
       
       $(function() {
           $('form').validate({
               submitHandler : function(form) {
		               $(form).ajaxSubmit(function(data) {
		                   if(data.result){
		                	   parent.layer.msg(data.msg, {time: 1000, icon:1});			                	   
		                   }else{
		                	   parent.layer.msg(data.msg, {time: 1000, icon:2});	
		                   }  
		                   var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
    		        	   parent.layer.close(index); 
		               });
               }
           });
           initSelector1();
           initSelector2();
           initSelector3();
           initSelector4();
       });
       
       function initSelector1(){
     	    var selector=  $("#customerId");
     		 selector.append("<option value='-1'>选择项目</option>"); 
     		 <#list customer as c>  //freemarker遍历用法
     		 var customerName="${c.customerName}";
     		 var id = "${c.customerId}";
     		 selector.append("<option value='"+id+"'>"+customerName+"</option>");
     		 </#list>
     		selector.val(${(orderform.customerId)!}); 
        }
      
      function initSelector2(){
    	    var selector=  $("#projectId");
    		 selector.append("<option value='-1'>选择项目</option>"); 
    		 <#list project as p>  //freemarker遍历用法
    		 var projectName="${p.projectName}";
    		var projectPrice="${p.projectPrice}";
    		 var id = "${p.projectId}";
    		 selector.append("<option value='"+id+"'>"+projectName+" "+projectPrice+"元"+"</option>");
    		 </#list>
    		selector.val(${(orderform.projectId)!}); 
       }
      
      function initSelector3(){
    	    var selector=  $("#userId");
    		 selector.append("<option value='-1'>选择技师</option>"); 
    		 <#list user as u>  //freemarker遍历用法
    		 var userName="${u.userName}";
    		 var id = "${u.userId}";
    		 selector.append("<option value='"+id+"'>"+userName+"</option>");
    		 </#list>
    		selector.val(${(orderform.userId)!}); 
       }
      
      function initSelector4(){
   	    var selector=  $("#roomId");
   		 selector.append("<option value='-1'>选择房间</option>"); 
   		 <#list room as r>  //freemarker遍历用法
   		 var roomNumber="${r.roomNumber}";
   		 var id = "${r.roomId}";
   		 selector.append("<option value='"+id+"'>"+roomNumber+"</option>");
   		 </#list>
   		selector.val(${(orderform.roomId)!}); 
      }
       
       
       
    </script>
    </body>
</html>    	 
    	 
    	 
    	 
    	 
    	 
    	 
    	   

